package com.ytjj.qmyx.users.service;
import com.alibaba.fastjson.JSONObject;
import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.users.model.Users;
import com.ytjj.qmyx.users.model.request.AppLoginRequest;
import com.ytjj.qmyx.users.model.request.LoginRequest;
import com.ytjj.qmyx.users.model.request.RegisterRequest;
import com.ytjj.qmyx.users.model.response.UsersResponse;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.math.BigDecimal;

/**
 *
 */
public interface LoginService {


    /**
     * 手机号+验证码登录
     *
     * @param registerRequest
     * @return
     */
    CommonResult register(RegisterRequest registerRequest);

    /**
     * app 登陆
     *
     * @return
     */
    UsersResponse appLogin(LoginRequest loginRequest);

    UsersResponse appLoginByIos(LoginRequest loginRequest);


    BigDecimal getUseSubsidyAmount(Integer userId);

    /**
     * 小程序 登陆
     *
     * @return
     */
    UsersResponse wxLogin(LoginRequest loginRequest);

    /**
     * app注册
     *
     * @param loginRequest
     * @return
     */
    UsersResponse appRegister(LoginRequest loginRequest);

    /**
     * h5注册
     *
     * @param loginRequest
     * @return
     */
    UsersResponse h5Register(LoginRequest loginRequest);

    /**
     * 去注册
     *
     * @param loginRequest
     * @return
     */
    UsersResponse toRegister(LoginRequest loginRequest,String token,String from);

    /**
     * 二次登陆补充信息
     *
     * @param loginRequest
     * @param users
     * @param token
     * @return
     */
    UsersResponse updateUsersInfo(LoginRequest loginRequest, Users users, String token);


    // 小程序登录

    /**
     *
     * @param request
     */
    JSONObject getToken(HttpServletRequest request) throws IOException;


    /**
     * 绑定新的手机号
     *
     * @param registerRequest
     * @return
     */
    CommonResult bindNewPhone(RegisterRequest registerRequest);

    /**
     * 校验用户手机号是否存在
     *
     * @param registerRequest
     * @return
     */
    CommonResult checkPhoneExist(RegisterRequest registerRequest);

    UsersResponse iosLogin(String account);

    /**
     * h5 登陆
     *
     * @return
     */
    UsersResponse h5Login(String source,String channel,String sourcePlatform, String token);

    /**
     * 保存openid
     *
     * @param userId
     * @param openid
     */
    void saveOpenId(Integer userId, String openid);

    Integer checkUserIsTalent(Integer userId, Integer status);

    /**
     * token登录
     * @param registerRequest
     * @return
     */
    CommonResult tokenLogin(RegisterRequest registerRequest);

    /**
     * 微信token登录
     * @param registerRequest
     * @return
     */
    CommonResult wxTokenLogin(RegisterRequest registerRequest);


    /**
     * 登陆用户打标签
     *
     * @param registerRequest
     */
    void makeTag(RegisterRequest registerRequest);

    /**
     * 保存app 用户 登录设备信息
     * @param request
     */
    void saveAppLogin(AppLoginRequest request);

    CommonResult<UsersResponse> wxUnionIdLogin(RegisterRequest registerRequest);
}
